<!---
* @Author: yaol
* @Date: 2021-01-18 9:32:43
* @Last Modified by: yaol
* @Last Modified time: 2021-01-18 9:32:43
-->
<!-- 批量导入 -->
<template>
  <div>
    <dg-excel-import module="BASE_API" :id="id" :name="typename" :params="params"
      :column-widths="{name:200,birthday:200}" :showLast="false" :tmeplateOpts="downloadTemplateOptions"
      @closeDialog="closeDialog" @importSuccess="importSuccess" :typeName="typename" >
    </dg-excel-import>
  </div>
</template>
<script>
  import dgExcelImport from "@/components/excel-import/index";
  export default {
    name: "BatchImport",
    components: {
      dgExcelImport
    },
    props:{
      id:{
        type:String,
        default:"qtxx_imp_template"
      },
      typename:{
        type:String,
        default:"案事件人员导入模板"
      },
      params:{
        type:Object,
        default:function(){
          return {}
        }
      },
    },
    mounted(){
      this.$bus.$on("Success", () => {
        this.importSuccess(true);
      });
    },
    data() {
      return {
        downloadTemplateOptions: [{
            label: "在校学生",
            id: "0",
          },
          {
            label: "集中务工人员",
            id: "1",
          },
          {
            label: "常住人员",
            id: "2",
          },
          {
            label: "社会流动人员",
            id: "3",
          },
        ]
      }
    },
    methods: {
      closeDialog() {
        this.$emit("close");
      },
      importSuccess(param){
        console.log("导入成功",param)
        this.$emit("success",param);
      }
    }
  }
</script>
